package com.myproject.mall.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.myproject.mall.domain.enums.OrderStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@TableName("scmall_order")
@Schema(description = "订单")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Order {
    @Schema(description = "订单ID")
    @TableId(value = "order_id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "卖方ID")
    @TableField(value = "order_seller_id")
    private String sellerId;

    @Schema(description = "买方ID")
    @TableField(value = "order_buyer_id")
    private String buyerId;


    /**
     * 商品ID和优惠卷ID，只能存在一个。<br/>
     * 订单包含购买商品和购买优惠券。
     */
    @Schema(description = "商品ID")
    @TableField(value = "order_goods_id")
    private Long  goodsId;

    @Schema(description = "优惠券ID")
    @TableField(value = "order_coupon_id")
    private Integer couponId;

    @Schema(description = "商品数量")
    @TableField(value = "order_amount")
    private Integer amount;

    @Schema(description = "订单金额")
    @TableField(value = "order_pay_money")
    private BigDecimal payMoney;

    @Schema(description = "原本金额")
    @TableField(value = "order_actual_money")
    private BigDecimal actualMoney;

    @Schema(description = "支付方式")
    @TableField(value = "order_pay_way")
    private String payWay;

    @Schema(description = "订单状态")
    @TableField(value = "order_status")
    private OrderStatus status;

    @Schema(description = "收货地址")
    @TableField(value = "order_ship_address")
    private String shipAddress;

    @Schema(description = "发货地址")
    @TableField(value = "order_delivery_address")
    private String deliveryAddress;

    @Schema(description = "订单创建时间")
    @TableField(value = "order_create_time")
    private LocalDateTime createTime;

    @Schema(description = "订单支付时间")
    @TableField(value = "order_pay_time")
    private LocalDateTime payTime;


}
